<div >
    <input type="hidden" id="current_branch" value="{{ current_branch }}">
    <table id="git_logs">
        <tbody>
        {% if len(logs) > 0 %}
        {% for info in logs %}
        <tr>
            <td class="has-menu" id="{{ info['CommitId'] }}"
                title="{{ info['Date'] + ' | ' + info['Author'] + ' | ' + info['message']  }}">{{ info['Date'] + ' | ' + info['Author'] + ' | ' + info['message']  }}</td>
        </tr>
        {% end %}
        {% else %}
        {% for i in xrange(15) %}
        <tr>
            <td title=""></td>
        </tr>
        {% end %}
        {% end %}
        </tbody>
    </table>
</div>
<nav >
    <ul id="icons" class="ui-widget ui-helper-clearfix">
        {% if paginator["page_no"] == 1 %}
        <li class="ui-state-disabled " title="首页"><span class="ui-icon ui-icon-seek-first"></span></li>
	    <li class="ui-state-disabled " title="上一页"><span class="ui-icon ui-icon-seek-prev"></span></li>
        {% else %}
        <li class="ui-state-active " title="首页"><a  href="javascript:load_commits(1)"><span class="ui-icon ui-icon-seek-first"></span></a></li>
	    <li class="ui-state-active " title="上一页"><a href="javascript:load_commits({{ paginator['previous_page'] }})"><span class="ui-icon ui-icon-seek-prev"></span></a></li>
        {% end %}

        {% if paginator["page_no"] == paginator["pages"] %}
        <li class="ui-state-disabled " title="下一页"><span class="ui-icon ui-icon-seek-next"></span></li>
	    <li class="ui-state-disabled " title="尾页"><span class="ui-icon ui-icon-seek-end"></span></li>
        {% else %}
        <li class="ui-state-active " title="下一页"><a href="javascript:load_commits({{ paginator['next_page'] }})"><span class="ui-icon ui-icon-seek-next"></span></a></li>
        <li class="ui-state-active " title="尾页"><a  href="javascript:load_commits({{ paginator['pages'] }})"><span class="ui-icon ui-icon-seek-end"></span></a></li>
        {% end %}
        <li class="ui-state-highlight"><input id="pageNo_l" style="width: 30px; height: 22px" type="text" value="{{ paginator['page_no'] }}"> / {{ paginator['pages'] }}</li>
        <li class="ui-state-highlight"><a href="javascript: page_gitlog({{ paginator['page_no'] }})">确定</a></li>
    </ul>
</nav>
<script type="text/javascript">
$(function() {
    $.contextMenu({
        selector: '.has-menu',
        items: {
            "tobe_cmid1": {name: "选为commit id 1", icon: "",
                callback: function(itemKey, opt, rootMenu, originalEvent) {
                    $("#commit_id_1").val(opt.$trigger[0].id);
                    $("#commit_id_1_info").val($("#current_branch").val() + "(" + opt.$trigger[0].innerText + ")");
                    $("#commit_id_1_branch").val($("#current_branch").val())
                }},
            "tobe_cmid2": {name: "选为commit id 2", icon: "",
                callback: function(itemKey, opt, rootMenu, originalEvent) {
                    $("#commit_id_2").val(opt.$trigger[0].id);
                    $("#commit_id_2_info").val($("#current_branch").val() + "(" + opt.$trigger[0].innerText + ")");
                }}
        }
    });
});
</script>
